package com.youhome.api.dto;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * Created by chen365 on 2018/05/25.
 */
@Data
@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
@ApiModel
public class HouseItemResult {
    @ApiModelProperty(notes = "房源ID")
    private String id;
    @ApiModelProperty(notes = "房源地址")
    private String address;
    @ApiModelProperty(notes = "价格")
    private Double price;
    @ApiModelProperty(notes = "价格单位")
    private String currency = "usd";
    @ApiModelProperty(notes = "销售状态")
    private String status;
    @ApiModelProperty(notes = "上市日期")
    private Long date;
    @ApiModelProperty(notes = "卧室数量")
    private Integer bedrooms;
    @ApiModelProperty(notes = "卫浴数量")
    private Integer bathrooms;
    @ApiModelProperty(notes = "房源类型")
    private String type;
    @ApiModelProperty(notes = "房源面积")
    private Double area;
    @ApiModelProperty(notes = "房源面积单位")
    private String area_unit = "sqft";
    @ApiModelProperty(notes = "土地面积")
    private Double lot;
    @ApiModelProperty(notes = "土地面积单位")
    private String lot_unit = "acre";
    @ApiModelProperty(notes = "建造年代")
    private Integer year;
    @ApiModelProperty(notes = "图片")
    private String photo;
    @ApiModelProperty(notes = "纬度")
    private Double latitude;
    @ApiModelProperty(notes = "经度")
    private Double longitude;
    @ApiModelProperty(notes = "土地编号")
    private String parcel_id;
    @ApiModelProperty(notes = "郡，县")
    private String county;
    @ApiModelProperty(notes = "邮编")
    private String zip;

    public String getPhoto() {
        if (!StringUtils.isEmpty(photo)) {
            photo = "https://youhome.oss-cn-zhangjiakou.aliyuncs.com/" + photo;
        }
        return photo;
    }
}
